<?php

/**
 * Application finalisation
 *
 * Should be included at the end of all Shopalong scripts
 *
 * Shopalong, the open source shopping system
 * http://shopalong.blogspot.com/
 *
 * @author Stuart Metcalfe <shoopdev@gmail.com>
 * @copyright Copyright &copy; 2003 osCommerce
 * @copyright Portions Copyright &copy; 2006, Shopalong
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 */

$eventManager->fireEvent('OutputEnding');
$eventManager->fireEvent('OutputEnded');

// close session (store variables)
$session->close();

if (STORE_PAGE_PARSE_TIME == 'true')
{
	$time_start = explode(' ', PAGE_PARSE_START_TIME);
	$time_end = explode(' ', microtime());
	$parse_time = number_format(($time_end[1] + $time_end[0] - ($time_start[1] + $time_start[0])), 3);
	error_log(strftime(STORE_PARSE_DATE_TIME_FORMAT) . ' - ' . getenv('REQUEST_URI') . ' (' . $parse_time . 's)' . "\n", 3, STORE_PAGE_PARSE_TIME_LOG);
	
	if (DISPLAY_PAGE_PARSE_TIME == 'true')
	{
		echo '<span class="smallText">Parse Time: ' . $parse_time . 's</span>';
	}
}

$eventManager->fireEvent('ProgramEnding');

?>
